<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Dashboard">
    <meta name="keyword" content="Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <title>Dashio - Bootstrap Admin Template</title>

    <!-- Favicons -->
    <link rel="icon" th:href="@{img/favicon.png}"/>
    <link rel="apple-touch-icon" th:href="@{img/apple-touch-icon.png}"/>

    <!-- <link href="img/favicon.png" rel="icon">
     <link href="img/apple-touch-icon.png" rel="apple-touch-icon">-->

    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" th:href="@{lib/bootstrap/css/bootstrap.min.css}"/>
    <!--   <link href="lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">-->
    <!--external css-->
    <link rel="stylesheet" th:href="@{lib/font-awesome/css/font-awesome.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{css/zabuto_calendar.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{lib/gritter/css/jquery.gritter.css}"/>

    <!-- <link href="lib/font-awesome/css/font-awesome.css" rel="stylesheet" />
     <link rel="stylesheet" type="text/css" href="css/zabuto_calendar.css">
     <link rel="stylesheet" type="text/css" href="lib/gritter/css/jquery.gritter.css" />-->
    <!-- Custom styles for this template -->
    <link rel="stylesheet" th:href="@{css/style.css}"/>
    <link rel="stylesheet" th:href="@{css/style-responsive.css}"/>
    <script th:src="@{lib/chart-master/Chart.js}"></script>

    <!-- <link href="css/style.css" rel="stylesheet">
     <link href="css/style-responsive.css" rel="stylesheet">
     <script src="lib/chart-master/Chart.js"></script>
 -->
</head>
<body>
<section id="container">
    <!--sidebar start-->
    <aside th:fragment="myLeftBar">
        <div id="sidebar" class="nav-collapse ">
            <!-- sidebar menu start-->
            <ul class="sidebar-menu" id="nav-accordion">
                <p class="centered"><a th:href="@{/userInfo}"><img src=" "
                                                                   class=" img-circle img-thumbnail img-responsive"
                                                                   width="80" id="headPic"></a></p>
                <h3 class="centered">Hello, <span
                        th:text="${session.SPRING_SECURITY_CONTEXT.authentication.principal.username}"></span></h3>
                <li class="mt">
                    <a th:href="@{/index}">
                        <i class="fa fa-dashboard"></i>
                        <span>首页</span>
                    </a>
                </li>

                <li class="sub-menu"  id="userManager" >
                    <span id="myUser">
                    </span>
                </li>


                <li class="sub-menu">
                    <a  th:href="@{/factory}" >
                        <i class="fa fa-tasks"></i>
                        <span>厂商管理</span>
                    </a>

                </li>

                <li class="sub-menu">
                    <a href="javascript:;">
                        <i class="fa fa-book"></i>
                        <span>主题管理</span>
                    </a>
                    <ul class="sub">
                        <li id="uploadTheme"><span id="upT"><a   th:href="@{/addTheme}"   value="add" >上传主题</a></span></li>
                        <li><span id="viewT"><a id="viewTheme" th:href="@{/theme}"    value="view"  >查看主题</a></span></li>
                    </ul>
                </li>

            </ul>
            <!-- sidebar menu end-->
        </div>
    </aside>
    <!--sidebar end-->
</section>


<!-- navbar -->
<a th:href="@{admin-offcanvas}" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu"
   data-am-offcanvas="{target: '#admin-offcanvas'}"><!--<i class="fa fa-bars" aria-hidden="true"></i>--></a>

<script type="text/javascript" th:src="@{assets/js/jquery-2.1.0.js}"></script>
<!--<script type="text/javascript" th:src="@{assets/js/app.js}"></script>-->
<script type="text/javascript" th:src="@{assets/js/blockUI.js}"></script>
<!--<script type="text/javascript" th:src="@{assets/js/charts/echarts.min.js}"></script>-->
<!--<script type="text/javascript" th:src="@{assets/js/charts/indexChart.js}"></script>-->
<script type="text/javascript" th:src="@{assets/js/amazeui.min.js}"></script>

<script type="text/javascript" th:inline="javascript">
    $(function () {
        var URL = [[@{
            /headPic}]];
            $.ajax({
                type: "get",
                url: URL,
                data: {},
                success: function (data) {
                    console.log(data);
                    $("#headPic").attr("src", "data:image/gif;base64," + data);
                }
            });
        }
    );


</script>

<!--验证登陆者的主题主题上传权限-->

<script type="text/javascript" th:inline="javascript">
    function checkUpload() {
        var URL = [[@{/checkPermission}]];
            var add="上传";
            $.ajax({
                type: "get",
                url: URL,
                data: {
                    action:add
                },
                success: function (data) {
                    console.log(data);
                    if (0 < parseInt(data)) {
                        $("#uploadTheme").show()
                    } else {

                        $("#uploadTheme").hide();
                    }
                }
            });
        }


</script>

<!--验证登陆者的主题主题查看权限-->

<script type="text/javascript" th:inline="javascript">
    function checkView() {
        var URL = [[@{/checkPermission}]];
            var view="查看";
            $.ajax({
                type: "get",
                url: URL,
                data: {
                    action:view
                },
                success: function (data) {
                    console.log(data);
                    if (0 < parseInt(data)) {
                        $("#viewTheme").show()
                    } else {

                        $("#viewTheme").hide();
                    }
                }
            });
        }


</script>

<!--验证登陆者的角色权限-->
<script type="text/javascript" th:inline="javascript">
    $(function () {
        var URL = [[@{
            /checkRole}]];
            $.ajax({
                type: "get",
                url: URL,
                data: {},
                success: function (data) {
                    console.log(data);
                    if (0 < parseInt(data)) {

                        $("#myUser").html(' <a  th:href="@{/user}" >\n' +
                            '                        <i class="fa fa-desktop"></i>\n' +
                            '                        <span >用户管理</span>\n' +
                            '                    </a>')
                       // $("#userManager").show()

                    } else {
                       // $("#userManager").hide();
                    }
                }
            });
        }
    )


</script>





<!-- js placed at the end of the document so the pages load faster -->
<script th:src="@{lib/jquery/jquery.min.js}"></script>

<script th:src="@{lib/bootstrap/js/bootstrap.js}"></script>
<script class="include" type="text/javascript" th:src="@{lib/jquery.dcjqaccordion.2.7.js}"></script>
<script th:src="@{lib/jquery.scrollTo.min.js}"></script>
<script th:src="@{lib/jquery.nicescroll.js}" type="text/javascript"></script>
<script th:src="@{lib/jquery.sparkline.js}"></script>
<!--common script for all pages-->
<script th:src="@{lib/common-scripts.js}"></script>
<script type="text/javascript" th:src="@{lib/gritter/js/jquery.gritter.js}"></script>
<script type="text/javascript" th:src="@{lib/gritter-conf.js}"></script>
<!--script for this page-->
<script th:src="@{lib/sparkline-chart.js}"></script>
<script th:src="@{lib/zabuto_calendar.js}"></script>

</body>
</html>